﻿using System;
using Manager;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Studio
{
	// Token: 0x020005B2 RID: 1458
	public class MapDragButton : MonoBehaviour, IDragHandler, IBeginDragHandler, IInitializePotentialDragHandler, IEndDragHandler, IPointerDownHandler, IPointerUpHandler, IEventSystemHandler
	{
		// Token: 0x0600251F RID: 9503 RVA: 0x000DCBF4 File Offset: 0x000DADF4
		public void OnInitializePotentialDrag(PointerEventData eventData)
		{
			Singleton<Studio>.Instance.cameraCtrl.isCursorLock = false;
			if (Singleton<Manager.GameCursor>.IsInstance())
			{
				Singleton<Manager.GameCursor>.Instance.SetCursorLock(true);
			}
			if (this.button)
			{
				this.button.transition = Selectable.Transition.None;
			}
		}

		// Token: 0x06002520 RID: 9504 RVA: 0x000DCC44 File Offset: 0x000DAE44
		public void OnBeginDrag(PointerEventData eventData)
		{
			if (this.onBeginDragFunc != null)
			{
				this.onBeginDragFunc();
			}
		}

		// Token: 0x06002521 RID: 9505 RVA: 0x000DCC5C File Offset: 0x000DAE5C
		public void OnDrag(PointerEventData eventData)
		{
			if (this.onDragFunc != null)
			{
				this.onDragFunc();
			}
		}

		// Token: 0x06002522 RID: 9506 RVA: 0x000DCC74 File Offset: 0x000DAE74
		public void OnEndDrag(PointerEventData eventData)
		{
			Singleton<Studio>.Instance.cameraCtrl.isCursorLock = true;
			if (Singleton<Manager.GameCursor>.IsInstance())
			{
				Singleton<Manager.GameCursor>.Instance.SetCursorLock(false);
			}
			if (this.button)
			{
				this.button.transition = Selectable.Transition.ColorTint;
			}
			if (this.onEndDragFunc != null)
			{
				this.onEndDragFunc();
			}
		}

		// Token: 0x06002523 RID: 9507 RVA: 0x000DCCD8 File Offset: 0x000DAED8
		public void OnPointerDown(PointerEventData eventData)
		{
		}

		// Token: 0x06002524 RID: 9508 RVA: 0x000DCCDC File Offset: 0x000DAEDC
		public void OnPointerUp(PointerEventData eventData)
		{
			Singleton<Studio>.Instance.cameraCtrl.isCursorLock = true;
			if (Singleton<Manager.GameCursor>.IsInstance())
			{
				Singleton<Manager.GameCursor>.Instance.SetCursorLock(false);
			}
			if (this.button)
			{
				this.button.transition = Selectable.Transition.ColorTint;
			}
		}

		// Token: 0x040025A0 RID: 9632
		[SerializeField]
		private Button button;

		// Token: 0x040025A1 RID: 9633
		public Action onBeginDragFunc;

		// Token: 0x040025A2 RID: 9634
		public Action onDragFunc;

		// Token: 0x040025A3 RID: 9635
		public Action onEndDragFunc;
	}
}
